<?php

namespace api\modules\v1\controllers;

use api\controllers\RestController;
use api\modules\v1\services\CourseStudy;

/**
 * Default controller for the `v1` module
 */
class StudyController extends RestController
{
    public $modelClass = 'api\modules\v1\services\CourseStudy';

    /**
     * 重写create操作，进行用户注册或添加
     * @name: actions
     * @return array
     * @author: rickeryu <lhyfe1987@163.com>
     * @time: 17/11/21 下午4:57
     */
    public function actions() {
        $actions = parent::actions(); // TODO: Change the autogenerated stub
        unset($actions['delete'], $actions['index'],$actions['update']);
        return $actions;
    }

    /**
     * 更新最后学习记录
     * @name: actionUpdate
     * @return string
     * @author: rickeryu <lhyfe1987@163.com>
     * @time: 2017/12/20 15:21
     */
    public function actionUpdate(){
        $post = \Yii::$app->getRequest()->post();
        $model = CourseStudy::findOne($post);
        if(  $model->save() ){
            return '更新成功';
        }
    }


}
